#include <iostream>
using namespace std;

int main()
{
	long long X, Y;
	cin >> X >> Y;
	long long Z = ((Y % X) == 0 ? X + Y : Y - X);
	cout << Z << endl;
	
	return 0;
 } 
